# 导包
import json

# 找到文件
test_data = "data/data2.json"
# 写入数据
param = {
    "name": "小明",
    "age": 18,
    "isMan": True,
    "likes": ["听歌", "游戏", "购物", "吃饭", "睡觉", "打豆豆"],
    "address": {"country": "中国", "city": "北京", "street": "王府街"}
}
with open(test_data, "w", encoding="utf-8") as f:
    json.dump(param, f, ensure_ascii=False)


with open(test_data,encoding="utf-8") as f:
    text = json.load(f)
    print(text["name"])
    print(text["likes"])
